7.6 Suppose we have the following:
LinkedList weights = new LinkedList();
ListIterator itr;
weights.add (5.3);
weights.add (2.8);
itr = weights.listIterator();
Hypothesize which of the following sequences of messages would now be legal:
a. itr.add (8.8); itr.next(); itr.remove();
b. itr.add (8.8); itr.remove(); itr.next();
c. itr.next(); itr.add (8.8); itr.remove();
d. itr.next(); itr.remove(); itr.add (8.8);
e. itr.remove(); itr.add (8.8); itr.next();
f. itr.remove(); itr.next(); itr.add (8.8);
Test your hypotheses.
 
 
View Solution
 
 
 
<< Back Next >>